import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/public/public_alert.dart';
import 'package:honeypotflutter/publicBussine/loginInfo/bussine_userInfo.dart';
import 'bussine_router_url.dart';

class MGAutonymMiddleware extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    UserInfoLogic _logic = Get.find<UserInfoLogic>();
    if (_logic.userInfo.realNameStatus == 1 && _logic.userInfo.courierState == 11) {
      return null;
    }

    //否则去认证界面
    Future.delayed(
      const Duration(seconds: 1),
      () => HLAlert.showSureAlert(title: "未认证", message: "您还未进行实名认证，请认证", okLabel: "我知道了"),
    );
    return RouteSettings(name: MGRouterUrl.autonym);
  }
}
